import React from 'react';
import { Route, Redirect } from 'react-router';
import { Switch, Router } from "react-router-dom";
import Routes from "./routes";
import { history } from "stores/routing";

//******************逻辑*********************/
export default () => (
  <Router history={history}>
    <div>
      <Switch>
        {/* 默认跳转到 service 页面 */}
        <Route exact path="/" render={() => <Redirect to="/service" />} />
        {
          Routes.map(({ name, path, component, exact = true }) => (
            <Route path={path} component={component} exact={exact} key={name}></Route>
          ))
        }
      </Switch>
    </div>
  </Router>
);

